package com.iotp.service.disease_type;

import com.iotp.dao.disease_type.DiseaseTypeMapper;
import com.iotp.entity.disease_type.DiseaseType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("diseaseTypeService")
public class DiseaseTypeServiceImpl implements DiseaseTypeService {
    @Autowired
    private DiseaseTypeMapper diseaseTypeMapper;

    @Override
    public Long add(DiseaseType diseaseType) {
        this.diseaseTypeMapper.insert(diseaseType);
        return diseaseType.getId();
    }

    @Override
    public void update(DiseaseType diseaseType) {
        this.diseaseTypeMapper.updateByPrimaryKeySelective(diseaseType);
    }

    @Override
    public void delete(Long id) {
        this.diseaseTypeMapper.deleteByPrimaryKey(id);
    }

    @Override
    public DiseaseType queryById(Long id) {
        return this.diseaseTypeMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<DiseaseType> queryList(DiseaseType diseaseType) {
        return this.diseaseTypeMapper.selectByCondition(diseaseType);
    }
}
